package edu.hitsz.aircraft.enemy;

import edu.hitsz.application.Main;
import edu.hitsz.bullet.BaseBullet;
import edu.hitsz.bullet.EnemyBullet;
import edu.hitsz.factory.propFactory.BloodPropFactory;
import edu.hitsz.factory.propFactory.BombPropFactory;
import edu.hitsz.factory.propFactory.BulletPropFactory;
import edu.hitsz.factory.propFactory.PropFactory;
import edu.hitsz.prop.AbstractProp;
import edu.hitsz.prop.BombProp;
import edu.hitsz.shootStrategy.ShootDirect;
import edu.hitsz.shootStrategy.ShootScatter;
import edu.hitsz.shootStrategy.ShootStrategy;

import java.util.LinkedList;
import java.util.List;

public class ElitePlusEnemy extends AbstractEnemy{

    public ElitePlusEnemy(int locationX, int locationY, int speedX, int speedY, int hp) {
        super(locationX, locationY, speedX, speedY, hp);
        super.direction=1;
        super.power=30;
        super.shootNum=3;

        super.setShootStrategy(new ShootScatter());
    }

    @Override
    public void forward() {
        super.forward();
        // 判定 y 轴向下飞行出界
        if (locationY >= Main.WINDOW_HEIGHT ) {
            vanish();
        }
    }



    @Override
    public List<AbstractProp> dropProp(int LocationX, int LocationY){
        PropFactory propFactory;//抽象道具工厂
        double rand = Math.random();
        if (rand < 0.4) {
            //1.创建工厂对象
            propFactory=new BloodPropFactory();
        } else if (rand < 0.7) {
            propFactory=new BombPropFactory();
        } else{
            propFactory=new BulletPropFactory();
        }

        List<AbstractProp> abstractProps=new LinkedList<>();
        //2.调用对象的createObject方法
        AbstractProp abstractProp =propFactory.createProp(LocationX,LocationY);
        abstractProps.add(abstractProp);
        return abstractProps;
    }


    @Override
    public void update() {
        this.decreaseHp(BombProp.power);
    }
}
